145862 ランダム
 ホーム | 日記 | プロフィール 【フォローする】 【ログイン】

Harryのひとりごと

Harryのひとりごと

表の利用


表の作成

<table border><tr><td>文字列</td></tr></table>

表の大きさの指定

<table width="表の横幅(ピクセル数又は比率%)">

表の位置の指定

<table align="位置(left,center,right)">表の内容</table>

表の見出しの設定

<th>文字列</th>

表のタイトルの設定

<caption>文字列</caption>
<bottom>文字列</bottom> (表の下に表示)

セルの高さの指定

<td height="セルの高さ(ピクセル数)">文字列</td>
<th height="セルの高さ(ピクセル数)">文字列</th>

<table border width="400" aligh="center">
<caption>文字列</caption>
<tr><th>文字列</th><th>文字列</th><tr>
<tr><td height=70>文字列</td><td>文字列</td></tr>
<tr><td>文字列</td><td>文字列</td></tr>
<bottom>文字列</bottom>
</table>



文字列
文字列文字列
文字列文字列
文字列文字列


セルの縦の結合

<td rowspan="(結合する)セル数">文字列</td>
<th rowspan="(結合する)セル数">文字列</th>

<table border>
<tr>
<td rowspan="2">文字列</td>
<td>文字列</td>
</tr>
<tr>
<td>文字列</td>
</tr>
</table>
文字列 文字列
文字列


セルの横の結合

<td colspan="(結合する)セル数">文字列</td>
<th colspan="(結合する)セル数">文字列</th>

<table border>
<tr><th colspan="2">文字列</th><tr>
<tr><td>文字列</td><td>文字列</td></tr>
<tr><td>文字列</td><td>文字列</td></tr>
</table>

文字列
文字列文字列
文字列文字列


セルどうしの間隔の設定

<table cellspacing="セルの間隔(ピクセル数)">表の中身</table>

<table border cellspacing="8">
<tr><th>文字列</th><th>文字列</th><tr>
<tr><td>文字列</td><td>文字列</td></tr>
<tr><td>文字列</td><td>文字列</td></tr>
</table>  指定しないと2ピクセル

文字列文字列
文字列文字列
文字列文字列


セルの余白の設定

<table cellpadding="セル内の余白(ピクセル数)">表の中身</table>

<table border cellpadding="10">
<tr><th>文字列</th><th>文字列</th><tr>
<tr><td>文字列</td><td>文字列</td></tr>
<tr><td>文字列</td><td>文字列</td></tr>
</table>

文字列文字列
文字列文字列
文字列文字列


表の外枠の太さの指定

<table border="線の太さ(ピクセル数)">表の中身</table>

<table border="10">
<tr><th>文字列</th><th>文字列</th><tr>
<tr><td>文字列</td><td>文字列</td></tr>
<tr><td>文字列</td><td>文字列</td></tr>
</table>  「0」の場合枠線が表示されない

文字列文字列
文字列文字列
文字列文字列


セル内の文字位置の指定

<td align="横位置(left,center,right)" valign="縦位置(top,middle,bottom)">セルの内容</td>
<th align="横位置(left,center,right)" valign="縦位置(top,middle,bottom)">セルの内容</th>
<tr align="横位置(left,center,right)" valign="縦位置(top,middle,bottom)">セルの内容</tr>

セルの背景色の設定

<td bgcolor="色(名前またはコード)" >セルの内容</td>
<th bgcolor="色(名前またはコード)" >セルの内容</th>
<tr bgcolor="色(名前またはコード)" >セルの内容</tr>

<table border>
<tr bgcolor="#77ff55">
<th>文字列</th><th>文字列</th></tr>
<tr>
<td align="center" valign="top">文字列</td>
<td>文字列
文字列</td></tr>




文字列文字列
文字列 文字列
文字列

© Rakuten Group, Inc.
X